<template>
	<div class="news">
		<h2>我是News组件</h2>
		<ul>
			<li v-for="news in newsList" :key="news.id">{{news.title}}</li>
		</ul>
	</div>
</template>

<script>
	export default {
		name:'News',
		data() {
			return {
				newsList:[
					{id:'001',title:'震惊！尚硅谷一男老师竟然'},
					{id:'002',title:'重要通知，有微信的否注意了'}
				],
				xuexiao:''
			}
		},
		mounted(){
			this.$bus.$on('haha',(val)=>{
				console.log('我是News组件，我收到了别人传过来的数据',val)
				this.xuexiao = val
			})
		},
		beforeDestroy(){
			this.$bus.$off('haha')
		}
	}	
</script>

<style>
	.news{
		background-color: skyblue;
		padding: 20px;
	}
</style>